/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thecliffproblem;

/**
 *
 * @author Jaime
 */
public enum Action {
    
       
    UP, DOWN, RIGHT, LEFT;
    
    public static Action idToAction(int id)
    {
       assert id >= 0 && id < 4;
       
       switch(id)
       {
           case 0: 
               return UP;
           case 1:
               return DOWN;
           case 2:
               return RIGHT;
           case 3:
               return LEFT;
           default:
               return null;
               
       }
       
       
    }
    
    public static int actionToID(Action a)
    {
        
        switch(a)
        {
            case UP:
                return 0;
            case DOWN:
                return 1;
            case RIGHT:
                return 2;
            case LEFT:
                return 3;
            default:
                return -1;
        }
           
    }
    
    public int getID()
    {
        return actionToID(this);
    }
    
}
